/**
 * 文 件 名:  ChannelService.java
 * 版      权:  财之道  Copyright ©2011-2015 All Rights Reserved
 * 描      述:  
 */
package com.czd.support.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.czd.base.service.BaseService;
import com.czd.support.model.Channel;
import com.czd.support.model.TreeModel;

/**
 * @Description  栏目业务类
 * 
 * @Author  Jun.Yang
 * @Date    2015年1月5日 下午1:06:17
 * @Version v1.0
 */
@Service
public class ChannelService extends BaseService<Channel> {
	public boolean insert(Channel channel) {
		return this.insert(sqlId("insert"), channel);
	}
	
	public boolean update(Channel channel) {
		return this.update(sqlId("update"), channel);
	}
	
	public boolean delete(int id) {
		return this.delete(sqlId("delete"), id);
	}
	
	public Channel findById(int id) {
		return this.selectOneById(sqlId("findById"), id);
	}
	
	public Channel findByCode(String code) {
		return this.selectOne(sqlId("findByCode"), code);
	}
	
	public List<Channel> listByParent(String level) {
		return this.selectList(sqlId("listByParent"), level);
	}
	
	public List<Channel> listByParentId(int id) {
		return this.selectList(sqlId("listByParentId"), id);
	}
	
	public List<TreeModel> createChannelTree() {
		return this.queryDao.getSqlSession().selectList(sqlId("createChannelTree"));
	}
	
	public List<Channel> getContentChannels(){
		return this.selectList(sqlId("getContentChannels"));
	}
}
